// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   ShortModuleTreeNode.java

package include.nseer_cookie;

import include.nseer_db.nseer_db;
import java.sql.ResultSet;
import javax.servlet.http.HttpSession;
import uk.ltd.getahead.dwr.WebContext;
import uk.ltd.getahead.dwr.WebContextFactory;

public class ShortModuleTreeNode
{

	WebContext ctx;
	HttpSession session;

	public ShortModuleTreeNode()
	{
		ctx = WebContextFactory.get();
		session = ctx.getSession();
	}

	public String Category(String categoryId, String tablename, String id)
	{
		nseer_db db = new nseer_db((String)session.getAttribute("unit_db_name"));
		nseer_db db1 = new nseer_db((String)session.getAttribute("unit_db_name"));
		String return_msg = "";
		try
		{
			String sql = (new StringBuilder("select * from ")).append(tablename).append("_view where PARENT_CATEGORY_ID='").append(categoryId).append("' and human_ID='").append((String)session.getAttribute("human_IDD")).append("' and workflow_tag='0'").toString();
			for (ResultSet rs = db.executeQuery(sql); rs.next();)
				if (rs.getInt("DETAILS_TAG") == 1)
					return_msg = (new StringBuilder(String.valueOf(return_msg))).append("<div style=\"background: transparent url(images/two.jpg) repeat-x 0 -15px;\"><a href=\"javascript:void(0)\" style=\"background-image:url(/erp/images/two.jpg);width:100%\" onclick=\"toggleNode(this.parentNode,'").append(rs.getString("CATEGORY_ID")).append("','").append(tablename).append("'); return false;\"  ><span style=\"padding:0px 0px 0px 3px\"><img src=\"/erp/images/tree_icon_folder_close.gif\" align=\"absmiddle\" style=\"border: 0;\" ></span><span style=\"padding:0px 0px 0px 8px\">").append(rs.getString("FILE_NAME")).append("</span></a></div>").toString();
				else
				if (!rs.getString("HREFLINK").equals(""))
				{
					String firstworkname = (new StringBuilder(String.valueOf(rs.getString("FILE_PATH")))).append(rs.getString("HREFLINK")).toString();
					String sql1 = (new StringBuilder("select * from drag_img where id='")).append(id).append("'").toString();
					ResultSet rs1 = db1.executeQuery(sql1);
					String checked = "";
					if (rs1.next() && rs1.getString("firstworkname").equals(firstworkname))
						checked = "checked";
					return_msg = (new StringBuilder(String.valueOf(return_msg))).append("<div style=\"background:#DDEAF6;width:100%\"><span style=\"padding:0px 0px 0px 8px\"></span><input type=\"radio\" name=\"firstwork_radio\" value=").append(rs.getString("FILE_PATH")).append(rs.getString("HREFLINK")).append(" ").append(checked).append(">").append(rs.getString("FILE_NAME")).append("</div>").toString();
				} else
				{
					return_msg = (new StringBuilder(String.valueOf(return_msg))).append("<div style=\"background:#DDEAF6;width:100%\"><span style=\"padding:0px 0px 0px 8px\"></span><input type=\"radio\" name=\"firstwork_radio\" value=").append(rs.getString("FILE_PATH")).append(rs.getString("HREFLINK")).append(">").append(rs.getString("FILE_NAME")).append("</div>").toString();
				}

			db.close();
			db1.close();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return return_msg;
	}
}
